package com.zzyl.mapper;

import com.zzyl.entity.Bed;
import com.zzyl.vo.BedVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BedMapper {

    List<BedVo> getBedsByRoomId(Long roomId);

    /**
     * 插入一条bed记录
     */
    void insert(Bed bed);

    /**
     * 根据床位id查询床位
     * @param id 床位id
     * @return
     */
    @Select("SELECT * FROM bed WHERE id = #{id}")
    Bed selectById(@Param("id") Long id);

    /**
     * 根据id更新床位信息
     * @param bed
     */
    void updateById(Bed bed);

    /**
     * 根据id删除床位
     * @param id 床位id
     */
    @Delete("delete from bed where id = #{id}")
    void deleteBed(Long id);
}

